﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefScanMaterialSN" :model="stateScanMaterialSN.vmModel" label-width="100px">
    <el-row>
      
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_lineCode_FormItem" prop="Entity.lineCode" label="产线编码">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.lineCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_stationCode_FormItem" prop="Entity.stationCode" label="工位编码">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.stationCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_operationCode_FormItem" prop="Entity.operationCode" label="工序编码">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.operationCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_assemblyMaterialCode_FormItem" prop="Entity.assemblyMaterialCode" label="组件物料编码">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.assemblyMaterialCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_assemblyMaterialName_FormItem" prop="Entity.assemblyMaterialName" label="组件物料名称">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.assemblyMaterialName" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_assemblyMaterialSN_FormItem" prop="Entity.assemblyMaterialSN" label="组件物料SN">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.assemblyMaterialSN" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_sort_FormItem" prop="Entity.sort" label="序号">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.sort" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_batchCode_FormItem" prop="Entity.batchCode" label="绑定批次">
            <el-input v-model="stateScanMaterialSN.vmModel.Entity.batchCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_BindTime_FormItem" prop="Entity.BindTime" label="绑定时间">
            <el-date-picker v-model="stateScanMaterialSN.vmModel.Entity.BindTime" clearable></el-date-picker>
        </el-form-item>
    </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onSubmitScanMaterialSN"  type="primary" :button-text="$t('message._system.common.vm.submit')" style="margin-top:15px;"/>
      <WtmButton @click="onCloseScanMaterialSN"  type="primary" :button-text="$t('message._system.common.vm.cancel')" style="margin-top:15px;"/>
    </div>
  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message._system.common.vm.add;false">
import {  ElMessageBox, ElMessage } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { ScanMaterialSNApi } from '/@/api/record/ScanMaterialSN';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

// 定义变量内容
const formRefScanMaterialSN = ref();
const stateScanMaterialSN = reactive({
    vmModel: {
	  Entity:{
      			lineCode: null,
			stationCode: null,
			operationCode: null,
			assemblyMaterialCode: null,
			assemblyMaterialName: null,
			assemblyMaterialSN: null,
			sort: null,
			batchCode: null,
			BindTime: null,

      },
      
	},
    
     
});

// 取消
const onCloseScanMaterialSN = () => {
    closeDialog();
};

// 提交
const onSubmitScanMaterialSN = () => {
    formRefScanMaterialSN.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            ScanMaterialSNApi().add(stateScanMaterialSN.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            })
		}
	})
};

// 页面加载时
onMounted(() => {
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

